clear; close all; clc;
load Left_30_Noise

left_sound = recorded_sound(:,1);
right_sound = recorded_sound(:,2);

figure
subplot(311)
Fs = 44100;
dt=1/Fs;
fsig = (1:length(left_sound))./length(left_sound).*Fs;
y=abs(fft(left_sound));
plot(fsig,y);xlim([0 500])
hold on;
load Left_30_A
subplot(312)
SN = recorded_sound(:,1);
y=abs(fft(SN));
plot(fsig,y,'r');
xlim([0 500])

sound(SN(1:10*Fs),Fs)
pause(15)

L = 256;
Px = mean(SN.^2);                    % Calculate waveform power for delta
delta = (1/(10*L*Px)) *.5;              % Convergence gain = .15
[b,ye,out] = lms(left_sound',SN',delta,L);         % Apply LMS algorithm
% sound(out,Fs)

y=abs(fft(out));
subplot(313)
plot(fsig,y,'r');xlim([0 500])
ylim([0 15000])

sound(out(1:10*Fs),Fs)
pause(10)